//
//  LzwGiftTableViewCell.m
//  NewHalfsugar
//
//  Created by 刘志武 on 16/1/2.
//  Copyright © 2016年 刘志武. All rights reserved.
//

#import "LzwGiftTableViewCell.h"
#import "UIImageView+WebCache.h"
#import "LzwBaseImageView.h"
#import "LzwBaseLable.h"

@interface LzwGiftTableViewCell ()

@property (nonatomic, retain) LzwBaseImageView *myIamgeGift;
@property (nonatomic, retain) LzwBaseImageView *myIamgeGift1;

@property (nonatomic, retain) LzwBaseLable *myLableGift;
@property (nonatomic, retain) LzwBaseLable *myLableGift1;



@end

@implementation LzwGiftTableViewCell

-(void)dealloc{
    [_myIamgeGift release];
    [_myIamgeGift1 release];
    [_myLableGift release];
    [_myLableGift1 release];
    [super dealloc];
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self creatGift];
    }
    
    return self;
    
}

-(void)creatGift{
    
    //图片
    self.myIamgeGift = [[LzwBaseImageView alloc]initWithFrame:CGRectMake(3 * WIDTH, 3 * WIDTH, 370 * WIDTH, 180 * WIDTH)];
    self.myIamgeGift.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.myIamgeGift];
    
    //喜爱图片
    self.myIamgeGift1 = [[LzwBaseImageView alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 70 * WIDTH, 230 * WIDTH, 20 * WIDTH, 20 * WIDTH)];
    self.myIamgeGift1.image = [UIImage imageNamed:@"love.png"];
    [self.contentView addSubview:self.myIamgeGift1];
    
    //描述
    self.myLableGift = [[LzwBaseLable alloc]initWithFrame:CGRectMake(2 * WIDTH, 185 * WIDTH, 369 * WIDTH, 45 * WIDTH)];
    self.myLableGift.textColor = [UIColor lightGrayColor];
    self.myLableGift.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableGift.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableGift];
    
    //喜爱人数
    self.myLableGift1 = [[LzwBaseLable alloc]initWithFrame:CGRectMake((375 - 20) / 2 - 50 + 5 * WIDTH, 230 * WIDTH, 60 * WIDTH, 20 * WIDTH)];
    self.myLableGift1.textColor = [UIColor lightGrayColor];
    self.myLableGift1.font = [UIFont systemFontOfSize:16 * WIDTH];
    self.myLableGift1.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.myLableGift1];
    
    [_myLableGift1 release];
    [_myLableGift release];
    [_myIamgeGift release];
    [_myIamgeGift1 release];
    

    
}

-(void)setModleGift:(LzwGiftModle *)modleGift{
    
    if (_modleGift != modleGift) {
        [_modleGift release];
        _modleGift = [modleGift retain];
    }
    
    self.myLableGift.text = self.modleGift.title;
    self.myLableGift1.text = self.modleGift.likes;
    
    NSURL *url = [NSURL URLWithString:self.modleGift.pic];
    
    [self.myIamgeGift sd_setImageWithURL:url placeholderImage:nil];
    

}



@end
